/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.siagefi.security;

import javax.enterprise.context.RequestScoped;
import javax.faces.context.ExternalContext;
import javax.inject.Inject;
import javax.inject.Named;

/**
 *
 * @author Paulo Lavarini
 */
@Named
@RequestScoped
public class Seguranca {

//    Esses metodos permiti o usuario com tal permissão usar o menu
    @Inject
    private ExternalContext externalContext;

    public boolean isBanco() {
        return externalContext.isUserInRole("ROLE_ADMIN");
    }

    public boolean isConta() {
        return externalContext.isUserInRole("ROLE_ADMIN");
    }

    public boolean isPerfil() {
        return externalContext.isUserInRole("ROLE_ADMIN");
    }

    public boolean isUsuario() {
        return externalContext.isUserInRole("ROLE_ADMIN");
    }

    public boolean isGrupoLancamento() {
        return externalContext.isUserInRole("ROLE_ADMIN");
    }

    public boolean isTipoDocumento() {
        return externalContext.isUserInRole("ROLE_ADMIN");
    }

    public boolean isTipoNotaFiscal() {
        return externalContext.isUserInRole("ROLE_ADMIN");
    }

    public boolean isTipoContrato() {
        return externalContext.isUserInRole("ROLE_ADMIN");
    }

    public boolean isAtividadePrincipal() {
        return externalContext.isUserInRole("ROLE_ADMIN")
                || externalContext.isUserInRole("ROLE_OPERADOR");
    }

    public boolean isCliente() {
        return externalContext.isUserInRole("ROLE_ADMIN")
                || externalContext.isUserInRole("ROLE_OPERADOR");
    }

    public boolean isFornecedor() {
        return externalContext.isUserInRole("ROLE_ADMIN")
                || externalContext.isUserInRole("ROLE_OPERADOR");
    }

    public boolean isFuncionario() {
        return externalContext.isUserInRole("ROLE_ADMIN")
                || externalContext.isUserInRole("ROLE_OPERADOR");
    }

    public boolean isContrato() {
        return externalContext.isUserInRole("ROLE_ADMIN")
                || externalContext.isUserInRole("ROLE_OPERADOR");
    }

    public boolean isDocumento() {
        return externalContext.isUserInRole("ROLE_ADMIN")
                || externalContext.isUserInRole("ROLE_OPERADOR");
    }

    public boolean isNotaFiscal() {
        return externalContext.isUserInRole("ROLE_ADMIN")
                || externalContext.isUserInRole("ROLE_OPERADOR");
    }
}
